package cn.caskm.souvenirshopsystem.domain;

import lombok.AllArgsConstructor;
import lombok.Data;

@Data
@AllArgsConstructor
public class Result <T> {

    private String msg;

    private T data;

    private Integer code;

    public static <T> Result<T> success(T data) {
        return new Result<>("success", data, 200);
    }


    public static <T> Result<T> success() {
        return new Result<>("success", null, 200);
    }

    public static <T> Result<T> fail(String msg) {
        return new Result<>(msg, null, 500);
    }

    public static <T> Result<T> unLogin() {
        return new Result<>("NOTLOGIN", null, 401);
    }

    public static <T> Result<T> forbidden() {
        return new Result<>("NOT_AUTH", null, 403);
    }

}
